package com.atguigu.demo.mapper;

import com.atguigu.demo.bean.Customer;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
@DS("mysql1018")
public interface CustomerMapper extends BaseMapper<Customer> {
        // #{} 传参，根据数据类型自动增加单引，解决sql注入的安全问题    ${} 传参，保持原型
    @Insert("insert into customer  values (#{customer.id} , #{customer.name},#{customer.age}) ")
    public  void insertCustomer(@Param("customer") Customer customer);

    @Select("select * from customer where name =#{name}")
    public List<Customer> selectCustomerbyName(String name );
}


